﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using jDepot.Models;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;

namespace jDepot.ViewModels
{
    public class ProductViewModel
    {
        [Required(ErrorMessage = "Product is required")]
        public Product Product { get; set; }
        public SelectList Categories { get; set; }

        public ProductViewModel()
        {
        }

        public ProductViewModel(IQueryable<ProductCategory> categories)
        {
            Categories = new SelectList(categories, "ProductCategoryId", "Name");
        }

        public ProductViewModel(Product product, IQueryable<ProductCategory> categories)
            : this(categories)
        {
            Product = product;
        }
    }
}